package com.jlect.swebing.ui.client;

import java.util.ArrayList;
import java.util.Iterator;

/**
 * Redirector for the key events
 *
 * @author Sergey Kozmin
 * @since 23.11.2007 23:18:17
 */
public class KeyListenerCollection extends ArrayList {
    public void eventAppeared(KeyEvent event) {
        for (Iterator iterator = iterator(); iterator.hasNext();) {
            KeyListener listener = (KeyListener) iterator.next();
            switch (event.getKeyEventType()) {
                case KeyEvent.KEY_PRESSED : {
                    listener.keyPressed(event);
                    break;
                }
                case KeyEvent.KEY_RELEASED : {
                    listener.keyReleased(event);
                    break;
                }
                case KeyEvent.KEY_TYPED : {
                    listener.keyTyped(event);
                    break;
                }
            }
        }
    }
}